#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
typedef struct LinkNode{
	int data;
	struct LinkNode *next;
}*LiStack;
void InitStack(LiStack *s){
	printf("初始化中....\n");
	//生成一个头结点
	*s = (LiStack) malloc(sizeof(struct LinkNode));
	if(*s == NULL){
		printf("malloc fail\n");
		exit(0);
	}
	printf("初始化成功！！\n");
	(*s)->next = NULL;
}
bool StackEmpty(LiStack S){
	if(S->next == NULL){ //如果头节点下一个节点为空，就可以说明这个栈为空栈
		return true;
	}
	else {
		return false;
	}
}
bool Push(LiStack S,int x){
	LiStack newNode = (LiStack) malloc(sizeof(struct LinkNode));
	newNode->data = x;
	//头插法
	newNode->next = S->next;
	S->next = newNode;
	return true;
}
bool Pop(LiStack S,int *x){
	if(StackEmpty(S)){
		return false;
	}
	LiStack temp = NULL;
	*x = S->next->data;
	//删除栈顶元素节点
	temp = S->next;
	S->next = temp->next;
	free(temp);
	return true;
}
bool GetTop(LiStack S,int *x){
	if(StackEmpty(S)){
		return false;
	}
	*x = S->next->data;
	return true;
}
//int CompareOpeator(char stackTop,char Out){
//	if()
//} 
int main(int argc, char *argv[]) {
	LiStack OperatorStack = NULL;
	LiStack DigitalStack = NULL;
	InitStack(&OperatorStack);
	InitStack(&DigitalStack);
	char str[50] = {"5+6*3(2+5)/3-1"};
	for(int i=0;i<strlen(str);i++){
		if(isnumber(str[i])){
			//如果是数字就进操作数栈
			Push(DigitalStack,str[i]);
		}
		else {
			//这里是运算符栈
//			if(str)
		}
	}
}